import model
import logging
import pprint
import datetime

import nmap

nm = nmap.PortScanner() 
host = '127.0.0.1'

#nm.scan(hosts = host, arguments = '-sS -sU -O -sC -A -T4')
with open('xml', 'r') as f:
    nm.analyse_nmap_xml_scan(f.read())

pprint.pprint(nm._scan_result)

for tcp_port in nm['127.0.0.1']['tcp']:
    name = attr['name']
    port = attr['port']
    proto = 'tcp'
    product = attr['product']
    reason = attr['reason']
    state = attr['state']
    version = attr['version']
    script = attr['script']    
    extra = attr['extrainfo']   
